home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac100% 1998 November
/
MAC100-1998-11.ISO.7z
/
MAC100-1998-11.ISO
/
オンラインソフト定点観測
/
ユーティリティ
/
Mops 3.2.sea
/
Mops 3.2
/
Mops source
/
PPC source
/
pBase
< prev
next >
Wrap
Text File
|
1998-06-08
|
4KB
|
171 lines
(*
This file is derived from Base. It's a "p" file - it contains any
defns from the original Base that:
1. are needed for the PPC image as generated on the 68k, and
2. have to be compiled AFTER we start compiling PPC code - i.e. after
CROSS at the beginning of Setup, which crosses us over into PPC-land.
So, here we only have to include words that compile to PPC code, and
never get executed at compile time.
Thus we only include words which come from Base and haven't been
included in qBase, as well as any from qBase that get executed at
both compile and run time. There aren't very many - I'll try to keep
it as short as possible and just add extra ones as we need them.
*)
: SAVE-INPUT
src-start src-len >in @ source-id 4 ;
: RESTORE-INPUT
dup 4 <> IF true EXIT THEN
drop
-> source-id >in ! -> src-len -> src-start false ;
¥ =========================
¥ U.H prints an unsigned number in hex. (.H is already defined, in pnuc2)
: U.H base >r hex u. r> -> base ;
¥ create BUF255 256 allot ¥ buffer for string operations
¥ - moved to setup before create and allot are redefined
: >STR255 ¥ ( addr len addr -- addr )
¥ Converts a string to a Str255 at addr
dup >r place r> ;
: STR255 ¥ ( -- ^buf255 )
buf255 >str255 ;
¥ ==================
¥ Once we're compiling PPC code, we have to keep the code and data areas
¥ distinct. DP points to the data area, and CDP points to the code area.
(* now in pnuc3
: code, CDP ! 4 ++> CDP ;
: codeW, CDP w! 2 ++> CDP ;
: codeC, CDP c! 1 ++> CDP ;
: codeN, ( addr len -- )
tuck
CDP swap cmove
++> CDP
;
: RESERVE ¥ ( len -- ) Allot and clear.
here over erase allot ;
: CODE_RESERVE
CDP over erase ++> CDP ;
*)
¥ ==================
syscall OpenResFile
syscall CloseResFile
¥ We can't leave OpenResFile or CloseResFile in the dic as syscalls, since
¥ they have another meaning in Mops. So we have to rename them:
& Z ' OpenResFile >namex 1+ c! ¥ Make it ZpenResFile
& Z ' CloseResFile >namex 1+ c! ¥ Make it ZloseResFile
0 value ResRefNum
: OpenResFile ¥ ( addr len -- ) Opens named resource file
str255 ZpenResFile
dup -> ResRefNum
-1 = abort" resource file open failed" ;
: CloseResFile ¥ ( -- )
ResRefnum ZloseResFile ;
: OPENMR ¥ Opens the Mops system resource file if necessary.
MRopen? ?EXIT ¥ Do nothing if already open
instld? ?EXIT ¥ or if this is an installed application
" mops.rsrc" OpenResFile
true -> MRopen? ;
syscall GetResource
: GETRES ¥ ( type resID -- handle )
GetResource ;
syscall GetString
: GETSTRING ¥ ( resID -- addr len ) Get the string with resource ID
openMR
GetString
dup
IF @ count ( addr len )
pad swap ( addr pad len ) ¥ i.e. ( src dest len)
dup >r ¥ save len
cmove
pad r> ( addr len )
ELSE
0
THEN ;
:f TSTR ¥ ( id# -- ) Prints string with given resID.
getString type ;f
: TO_BE_WRITTEN 79 die ;
¥ =================== MARKER =====================
(* On the PPC we don't support FORGET any more, since it's too tricky
with saparate code and data. So we'll deprecate FORGET, and
encourage use of the standard word MARKER.
For MARKER, we don't use <builds...does> as on the 68k, since
there's no need to put the marker info in the data area, 'cause
it's only used during development. A marker just becomes a
defn with a special handler code, and we put the associated
info straight after the header in the code area.
We can't execute the marker in the handler, since at that stage
we're probably in the execution buffer so resetting CDP wouldn't
be very sensible. So we just compile a call to (mrk) which does
the work. (mrk) is in zBase, along with the other related words.
We just need MARKER here in pBase, since when we natively load
the first file (zBase) we need MARKER to already exist, so that
zBase gets a proper file mark.
*)
: MARKER
CDP
ppc_header
$ BC410000 code, ¥ marker_h handler code, and alignment
¥ Note - we'll indicate a file mark
¥ by putting something nonzero in these
¥ pad bytes
( orig-CDP ) displCode,
DP displCode,
; ppc_only
endload